<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>test</title>
    <link rel="stylesheet" href="./assets/font-awesome-4.7.0/css/font-awesome.min.css">
</head>
<body>
    <div id="option"></div>
    <script src="./assets/js/vue.js"></script>
    <script src="./assets/js/vue-router.js"></script>
    <script src="./assets/js/httpVueLoader.js"></script>
    <script type="text/javascript" src="./assets/js/jquery-3.6.0.min.js"></script>


    <script>
        const option = httpVueLoader("./vue/option.vue");
        const frontpage = httpVueLoader("./vue/frontpage.vue");
        const gm = httpVueLoader("./vue/GoodsList.vue");
        const ag = httpVueLoader("./vue/addgoods.vue");
        const cg = httpVueLoader("./vue/category.vue");

        

        
        Vue.component("ag",ag);
        Vue.component("cg",cg);


        const router = new VueRouter({
            routes: [
                { path: "/", component: frontpage },
                { path: "/gm", component: gm },
            ]
        });

        let localgoods = JSON.parse(localStorage.getItem("goods"));
        let localcategorys = JSON.parse(localStorage.getItem("categorys"));
        if (localcategorys === null) {
            localcategorys = [
                {categoryname:"百货",goodsmount:1},
                {categoryname:"美妆",goodsmount:0},
                {categoryname:"男装",goodsmount:0},
                {categoryname:"女装",goodsmount:0},
                {categoryname:"数码",goodsmount:0},
                {categoryname:"母婴",goodsmount:0},
            ]
            localStorage.setItem("categorys",JSON.stringify(localcategorys));
        }
        if (localgoods === null) {
            localgoods = [{
                category:"百货",
                goodsname:"converse",
                price:120,
                imgurl:"./img/1.jpeg",
                comment:"converse*>"
            }]
            localStorage.setItem("goods",JSON.stringify(localgoods));
        }
       

        new Vue({
            router,
            render:(h) => h(option)
        }).$mount("#option")
    </script>
</body>
</html>